package designMode.compoundPattern;

/**
 * @author LIBOFEI
 * @ClassName RubberDuck
 * @description 这是一只橡皮鸭
 * @date 2020/7/1 14:22
 * @Version 1.0
 **/
public class RubberDuck implements Quackable {

    Observable observable;

    public RubberDuck(){
        observable = new Observable(this);
    }

    @Override
    public void quack() {
        System.out.println("橡皮鸭 吱吱吱");
        notifyObservers();
    }

    @Override
    public void registerObserver(Observer observer) {
        observable.registerObserver(observer);
    }

    @Override
    public void notifyObservers() {
        observable.notifyObservers();
    }
}
